package com.peaksport.framework.metadata.venum;

import com.peaksport.framework.exception.PKDevException;

/**
 * filter过滤条件的合并方式
 * 
 * @author jinbin_guo  2019年4月15日 下午4:43:53
 *
 */
public enum MergeLogicEnum {

    OR("or"),AND("and");

    private String value;
    private MergeLogicEnum(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static MergeLogicEnum get(String mergeLogic) {
        if (mergeLogic == null) return null;
        mergeLogic = mergeLogic.trim().toLowerCase();
        if ("or".equals(mergeLogic))  return OR;
        else if ("and".equals(mergeLogic)) return AND;
        else throw PKDevException.throwException("暂未支持的过滤合并的枚举值[%s],请联系统管理人员.", mergeLogic);
    }

    @Override
    public String toString() {
        return value;
    }
}
